<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!doctype html>
<html class="no-js">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="">
    <meta name="keywords" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>沃店</title>
    <!-- Set render engine for 360 browser -->
    <meta name="renderer" content="webkit">
    <!-- No Baidu Siteapp-->
    <meta http-equiv="Cache-Control" content="no-siteapp"/>

    <!-- Add to homescreen for Chrome on Android -->
    <meta name="mobile-web-app-capable" content="yes">

    <!-- Add to homescreen for Safari on iOS -->
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-title" content="Amaze UI"/>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/assets/css/amazeui.min.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/assets/css/app.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/assets/css/index.css">
    <!--必要样式-->
    <style type="text/css">
        .menuItem img {
            width: 100%;
        }

        body {
            background-color: #EFEFEF;
        }

        .package {
            background-color: #fff;
            padding: 10px 5px 10px 5px;
            height: 75px;
            margin-top: 1px;
        }

        .package a {
            float: right;
            font-size: 12px;
            padding: 2px 4px 2px 4px;
            border-radius: 3px;
            color: #ff6a06;
            border: 1px #ff6a06 solid;
            margin-top: 10px;
        }
    </style>
</head>

<body>
<header data-am-widget="header" class="am-header am-header-default am-header-fixed">
    <div class="am-header-left am-header-nav">
        <a href="${pageContext.request.contextPath}/clientHome/userInfo" class="">
            <i class="am-header-icon am-icon-chevron-left"></i>
        </a>
    </div>
    <h1 class="am-header-title">
        <a href="#title-link" class="">
            积分商城
        </a>
    </h1>

</header>
<div class="am-g">
    <div class="clearpadding am-u-sm-12">
        <img src="${pageContext.request.contextPath}/images/broadband.png" style="width: 100%;">
    </div>
</div>
<div class="am-g" style="background-color: #fff;padding-top:10px;padding-bottom: 10px; ">
    <div class="am-u-sm-6" align="center" style="border-right: 1px #ccc solid;">我的积分：${user.integral}</div>
    <div class="am-u-sm-6" align="center">
        <a href="${pageContext.request.contextPath}/clientHome/goIntegral">
            积分记录</a>
    </div>
</div>
<div class="am-g" style="margin-top: 15px;" id="list">
    <div class="am-g package" v-for="item in items">
        <div class="am-u-sm-3">
            <img :src="item.goodsImageUrl" style="width:100%;height: 50px;">
        </div>
        <div class="am-u-sm-5">
            <span class="am-text-truncate" style="display: block;">{{item.goodsName}}</span>

            <span class="am-text-truncate"
                  style="font-size: 12px;display: block;margin-top: 5px;">积分{{item.goodsPrice}}</span>
        </div>
        <div class="am-u-sm-4">
            <div class=" " v-on:click="exchangePro(item.id)">兑换</div>
        </div>
        <div class="clearpadding am-u-sm-12"></div>
    </div>
</div>

<!--[if (gte IE 9)|!(IE)]><!-->
<script src="${pageContext.request.contextPath}/assets/js/jquery.min.js"></script>
<script src="${pageContext.request.contextPath}/assets/js/amazeui.min.js"></script>
<script src="${pageContext.request.contextPath}/assets/js/vue.js"></script>
<script src="${pageContext.request.contextPath}/layer/layer.js"></script>
<script type="text/javascript">

    var list = new Vue({
        el: "#list",
        data: {
            items: []
        },
        methods: {
            exchangePro: function (id) {
                layer.confirm('确认兑换', {
                    btn: ['确认', '取消'] //按钮
                }, function () {
                    window.location.href = "${pageContext.request.contextPath}/userGoodsOrder/integralOrder?id=" + id;
                }, function () {

                });
            }
        }
    });

    $(function () {

        $.ajax({
            type: "get",
            url: '${pageContext.request.contextPath}/clientIntegralGoods/findAll',
            dataType: 'json',
            success: function (data) {
                if (data.code == 200 && data.success == true) {
                    list.items = data.obj;
                } else {
                    layer.msg(data.msg);
                }
            }

        });

    });

</script>
</body>

</html>
